#include "StdAfx.h"
#include "RoleMgr.h"
#include "Role.h"

GRoleMgr RoleMgr;
GRoleMgr& GRoleMgr::Inst()
{
	return RoleMgr;
}
GRoleMgr::GRoleMgr(void)
{
}
GRoleMgr::~GRoleMgr(void)
{
}
void GRoleMgr::AddRole(GRole* pRole)
{
	pair<map<DWORD, GRole*>::iterator, bool> ret;
	ret = m_mapRole.insert(make_pair(pRole->GetRoleID(), pRole));
	if(ret.second == false) assert(0);
}
GRole* GRoleMgr::GetRole(DWORD dwRoleID)
{
	map<DWORD, GRole*>::iterator iter = m_mapRole.find(dwRoleID);
	if (iter != m_mapRole.end())
	{
		return iter->second;
	}
	return NULL;
}